﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

/// <summary>
/// 战斗武学
/// </summary>
public class FightWuxue : MonoBehaviour {

    /// <summary>
    /// 武学类型（0：防御武学，1：攻击武学）
    /// </summary>
    public int WuxueType;
    /// <summary>
    /// 武学序数
    /// </summary>
    public int WuxueIndex;

    private Image WuxueImage;
    private Personage ThePersonage;
    private PersonageWuxue ThePersonageWuxue;

    // Use this for initialization
    void Start () {
        this.WuxueImage = GetComponent<Image>();

        GlobalData globalData = GlobalData.Instance;
        this.ThePersonage = globalData.OurFightTeam[0];
        if (this.WuxueType == 0 && this.ThePersonage.DefWuxues.Count > this.WuxueIndex) {
            this.ThePersonageWuxue = this.ThePersonage.DefWuxues[this.WuxueIndex];
            this.WuxueImage.sprite = Resources.Load<Sprite>(this.ThePersonageWuxue.Wuxue.Sprite);
        } else if (this.WuxueType == 1 && this.ThePersonage.AttWuxues.Count > this.WuxueIndex) {
            this.ThePersonageWuxue = this.ThePersonage.AttWuxues[this.WuxueIndex];
            this.WuxueImage.sprite = Resources.Load<Sprite>(this.ThePersonageWuxue.Wuxue.Sprite);
        } else {
            this.gameObject.SetActive(false);
        }
    }
	
	// Update is called once per frame
	void Update () {
		
	}
}
